﻿Public Class clientMonitor

    Private Sub TestSendPacket()
        If lstConnected.Items.Count <= 0 Then
            MsgBox("Tidak ada Client yang terhubung!")
        ElseIf lstConnected.SelectedIndex = -1 Then
            MsgBox("Silahkan pilih salah satu client pada list!")
        Else
            For Each Conn As frmMain.Connections In frmMain._Connections
                If Conn.Sockets.Client.Connected Then
                    If lstConnected.Items.Item(lstConnected.SelectedIndex).ToString.Equals(Conn.Sockets.Client.Client.RemoteEndPoint.ToString) Then
                        Dim messageData() As Byte = System.Text.Encoding.ASCII.GetBytes("Anda Menerima Pesan Dari Server" + Packet.pEof)
                        Conn.Sockets.Stream.Write(messageData, 0, messageData.Length)
                        Exit For
                    End If
                End If
            Next
        End If
    End Sub

    Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub
End Class